using System.Net;
using Cysharp.Threading.Tasks;
using GameFramework.Network;
using GameFramework.Request;

namespace GameFramework.GameServer
{
    /// <summary>
    /// 游戏服务器交互服务
    /// </summary>
    public interface IGameServerService
    {
        /// <summary>
        /// 是否已连接
        /// </summary>
        bool Connected { get; }
        
        /// <summary>
        /// 连接服务器
        /// </summary>
        UniTask<int> Connect(IPAddress ipAddress, int port);
        
        /// <summary>
        /// 断开连接
        /// </summary>
        void Disconnect();

        /// <summary>
        /// 发送协议包 并等待返回
        /// </summary>
        UniTask<IResponse> SendAsync(Packet packet);
    }
}